package com.tongtech.proxy.objects;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class TreeNode {
    Integer value;
    Integer[] snapshot;

    List<TreeNode> sonPtr = new ArrayList<>();

    List<Integer> result = new ArrayList<>();

    public TreeNode() {
    }


    public Integer getValue() {
        return value;
    }

    public void setValue(Integer value) {
        this.value = value;
    }

    public Integer[] getSnapshot() {
        return snapshot;
    }

    public void setSnapshot(Integer[] snapshot) {
        Integer[] tmp = new Integer[snapshot.length];
        System.arraycopy(snapshot, 0, tmp, 0, snapshot.length);
        this.snapshot = tmp;
    }


    public List<TreeNode> getSonPtr() {
        return sonPtr;
    }

    public void setSonPtr(List<TreeNode> sonPtr) {
        this.sonPtr = sonPtr;
    }

    public void addSonNode(TreeNode node) {
        this.sonPtr.add(node);
    }

    public List<Integer> getResult() {
        return result;
    }

    public void setResult(List<Integer> result) {
        this.result = result;
    }

    public void addResult(Integer step){
        this.result.add(step);
    }

    @Override
    public String toString() {
        return "TreeNode{" +
                "value=" + value +
                ", snapshot=" + Arrays.toString(snapshot) +
                ", sonPtr=" + sonPtr +
                ", result=" + result +
                '}';
    }
}
